package com.wdl.modules.myhouse.spider;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.beans.Encoder;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.HashSet;

/**
 * @author 昏昏的君
 */
public class TestSpider {
    public static void main(String[] args) throws IOException {
        String decode = URLDecoder.decode("https://www.ghxi.com/%e2%80%8b%e2%80%8bresumebuilder.html", "UTF-8");
        System.out.println(decode);
    }

    public static void getRootLinks(String url) throws IOException {
        Document document = Jsoup.connect("https://www.ghxi.com/category/all/android/xposed").get();
        Elements elements = document.select(".primary-menu");
        Elements eles = elements.select(".menu-item");
        HashSet<String> set = new HashSet<>();
        for(Element ele:eles ){
            String attr = ele.select("a").attr("href");
            set.add(attr);
        }
        System.out.println(set);
        System.out.println(set.size());
    }
}
